//消息弹框提示layer
if (typeof tyNamespace.TipsSectencesIndex == "undefined") {
	tyNamespace.TipsSectencesIndex = {};
	tyNamespace.TipsSectencesIndex.TaoTai = 4;//兑换券淘汰
	tyNamespace.TipsSectencesIndex.DuihunSuc = 6;//兑换成功
	tyNamespace.TipsSectencesIndex.DelOneEmail = 15;//删除一个邮件
	tyNamespace.TipsSectencesIndex.DelAllEmail = 12;//删除所有邮件
	tyNamespace.TipsSectencesIndex.GetOneAttachmentSuc = 16;//提取一个附件成功
	tyNamespace.TipsSectencesIndex.GetAllAttachmentSuc = 13;//提取所有附件成功
	tyNamespace.TipsSectencesIndex.FeedBackSuc = 35;//反馈成功
	tyNamespace.TipsSectencesIndex.PleaseWaiting = 36;//敬请期待
	tyNamespace.TipsSectencesIndex.TobeVipSuc = 41;//恭喜成为vip
}
tyNamespace.TipsLayer = cc.Layer.extend({
	btNum:null,
	TipsSectencesIndex:null,
	callback:null,
	
	ctor:function(btNum,TipsSectencesIndex,callback){
		this._super();
		if(btNum){
			this.btNum = btNum;
		}
		if(TipsSectencesIndex){
			this.TipsSectencesIndex = TipsSectencesIndex;
		}
		if(callback){
			this.callback = callback;
		}
		this.init();
	},
	init: function () {
		cc.spriteFrameCache.addSpriteFrames(gpNamespace.tipsRes.Tips_plist);
		cc.spriteFrameCache.addSpriteFrames(gpNamespace.pdkTanKuangRes.tankuang_plist);
		var background = new cc.Sprite(gpNamespace.tankuang.background);
		background.attr({
			x: cc.winSize.width/2,
			y: cc.winSize.height/2
		});
		this.addChild(background);
		
		var sentence = null;
		switch (this.TipsSectencesIndex) {
		case tyNamespace.TipsSectencesIndex.DuihunSuc:
			sentence = new cc.Sprite(gpNamespace.tips.Tips_sectence6);
			break;
		case tyNamespace.TipsSectencesIndex.DelAllEmail:
			sentence = new cc.Sprite(gpNamespace.tips.Tips_sectence12);
			break;
		case tyNamespace.TipsSectencesIndex.GetAllAttachmentSuc:
			sentence = new cc.Sprite(gpNamespace.tips.Tips_sectence13);
			break;
		case tyNamespace.TipsSectencesIndex.DelOneEmail:
			sentence = new cc.Sprite(gpNamespace.tips.Tips_sectence15);
			break;
		case tyNamespace.TipsSectencesIndex.GetOneAttachmentSuc:
			sentence = new cc.Sprite(gpNamespace.tips.Tips_sectence16);
			break;
		case tyNamespace.TipsSectencesIndex.FeedBackSuc:
			sentence = new cc.Sprite(gpNamespace.tips.Tips_sectence35);
			break;
		case tyNamespace.TipsSectencesIndex.PleaseWaiting:
			sentence = new cc.Sprite(gpNamespace.tips.Tips_sectence36);
			break;
		case tyNamespace.TipsSectencesIndex.TobeVipSuc:
			sentence = new cc.Sprite(gpNamespace.tips.Tips_sectence41);
			break;
		default:
			sentence = new cc.LabelTTF(this.TipsSectencesIndex,gpNamespace.DEFAULTFONT,30);
			sentence.setFontFillColor(cc.color(108, 28, 11, 255));
			break;
		}
		
		sentence.attr({
			x: background.width / 2,
			y: 212 ,
		});
		background.addChild(sentence);
		
		var menuItems = [];
		//Tips_Confirm Tips_Cancel
		if(this.btNum == 2){
			var confirm = new cc.MenuItemImage(gpNamespace.tankuang.queding,gpNamespace.tankuang.queding,this.confirmCallback,this);
			confirm.attr({
				x: 90,
				y: 15,
				anchorX: 0,
				anchorY: 0
			});
			confirm.setUserData(this);
			menuItems.push(confirm);
			var cancel = new cc.MenuItemImage(gpNamespace.tankuang.quxiao,gpNamespace.tankuang.quxiao,this.cancelCallback,this);
			cancel.attr({
				x: 335,
				y: 15,
				anchorX: 0,
				anchorY: 0
			});
			cancel.setUserData(this);
			menuItems.push(cancel);
		}else{
			var confirm = new cc.MenuItemImage(gpNamespace.tankuang.queding,gpNamespace.tankuang.queding,this.confirmCallback,this);
			confirm.attr({
				x: 212,
				y: 15,
				anchorX: 0,
				anchorY: 0
			});
			confirm.setUserData(this);
			menuItems.push(confirm);
		}
		
		var menu = new cc.Menu(menuItems);
		menu.attr({
			x:0,
			y:10,
			anchorX: 0,
			anchorY: 0
		});
		background.addChild(menu);
	},
	cancelCallback:function(sender){
		cc.log("cancelCallback");
		var self = sender.getUserData();
		self.getParent().getParent().removeFromParent(true);
	},
	confirmCallback:function(sender){
		cc.log("confirmCallback");
		var self = sender.getUserData();
		if(self.callback != null){
			self.callback.apply(self);
		}
		self.getParent().getParent().removeFromParent(true);
	}
})